package com.ewanghuiju.app.ui.main.adapter;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

/**
 * @author sj  qq:751943509
 * @class describe
 * @time 2020/2/28
 */
public class MyPagerAdapter  extends FragmentPagerAdapter {
    private List<Fragment> mFragments;
    private List<String> list_Title;

    public MyPagerAdapter(@NonNull FragmentManager fm, int behavior, List<Fragment> fragments, List<String> list_Title) {
        super(fm, behavior);
        this.mFragments = fragments;
        this.list_Title = list_Title;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return list_Title==null?0:list_Title.size();
    }
    @Override
    public CharSequence getPageTitle(int position) {
        return list_Title.get(position);
    }
}
